package com.keeplearning;

import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

@Data
@Builder
public class DiamondRow {
    private char letter;
    private int leftPad;
    private int middlePad;

    public String format() {
        StringBuilder buf = new StringBuilder();
        if (leftPad > 0) {
            buf.append(StringUtils.leftPad(" ", leftPad));
        }

        buf.append(letter);

        if (middlePad > 0) {
            buf.append(StringUtils.leftPad(" ", middlePad)).append(letter);
        }
        return  buf.toString();
    }


}
